package org.phalanx.messenging;

public class PingTimeMessage extends AbstractMessage {
	public static final String PING_REQUEST = "PING";
	public static final String PING_REPLY = "PONG";
	
	public PingTimeMessage(){
		this.setMessageHeader("PingTimeMessage");
	}
	
	public void setAction(String action){
		this.setToMessage("ACTION", action);
	}
	
	public String getAction(){
		return (String)this.getFromMessage("ACTION");
	}
	
	public boolean getIsPing(){
		boolean isPing = false;
		String pingOrPong = (String)this.getFromMessage("ACTION");
		
		if (pingOrPong != null){
			isPing = pingOrPong.equals(PING_REQUEST) ? true : false;
		}
		
		return isPing;
	}
}
